package com.sunwayworld.basemodule.samplemanage.location.resource;

import com.alibaba.fastjson.JSONObject;
import com.sunwayworld.basemodule.samplemanage.location.bean.LimsLocationBean;
import com.sunwayworld.basemodule.samplemanage.location.bean.LimsLocationBoardBean;
import com.sunwayworld.basemodule.samplemanage.location.bean.LocationDTO;
import com.sunwayworld.basemodule.samplemanage.location.service.LimsLocationService;
import com.sunwayworld.framework.restful.data.RestJsonWrapperBean;
import com.sunwayworld.framework.support.base.resource.GenericResource;
import com.sunwayworld.framework.support.choosable.resource.GenericChoosableResource;
import com.sunwayworld.framework.support.selectable.resource.GenericSelectableResource;
import com.sunwayworld.framework.support.tree.resource.GenericTreeResource;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RequestMapping("/secure/baseline/samplemanage/locations")
public interface LimsLocationResource extends GenericResource<LimsLocationService, LimsLocationBean, Long>,
        GenericChoosableResource<LimsLocationService, LimsLocationBean, Long>,
        GenericSelectableResource<LimsLocationService, LimsLocationBean, Long>,
        GenericTreeResource<LimsLocationService, LimsLocationBean, Long> {

    @DeleteMapping("/delete/{group}")
    void deleteByGroup(@PathVariable String group);

    @PostMapping("/insert/boards")  //add/boards
    void saveBoards(RestJsonWrapperBean wrapperBean);

    @PostMapping("/update/boards")
    void removeBoards(RestJsonWrapperBean wrapperBean);

    @PostMapping("/append/locations")
    Boolean appendLocations(RestJsonWrapperBean wrapper);

    // 可视化样本库接口

    @RequestMapping(value = "/tree",method = RequestMethod.POST)
    List<LocationDTO> selectTreeList(@RequestBody LimsLocationBean locationBean);

    @RequestMapping(value = "/static/data",method = RequestMethod.GET)
    List<Map<String,Object>> staticData(String codeCategoryId);

    @RequestMapping(value = "/queries/storage")
    List<LimsLocationBean> queriesStorage(@RequestBody LimsLocationBean locationBean);

    @RequestMapping(value = "/insert",method = RequestMethod.POST)
    Long insertStorage(@RequestBody LimsLocationBean locationBean);

    @RequestMapping(value = "/edit",method = RequestMethod.POST)
    List<LimsLocationBean> editStorage(@RequestBody LimsLocationBean locationBean);

    @RequestMapping(value = "/save/layer",method = RequestMethod.POST)
    LimsLocationBean saveLayer(@RequestBody LimsLocationBean locationBean);

    @RequestMapping(value = "/add/layer",method = RequestMethod.POST)
    Long addLayer(@RequestBody LimsLocationBean locationBean);

    @RequestMapping(value = "/del",method = RequestMethod.POST)
    JSONObject delStorage(@RequestBody LimsLocationBean locationBean);

    @RequestMapping(value = "/del/childLayer",method = RequestMethod.POST)
    JSONObject delLayerChild(@RequestBody LimsLocationBean storageLocationBean);

    @RequestMapping(value = "/add/box",method = RequestMethod.POST)
    Long addBox(@RequestBody List<LimsLocationBean> locationBeans);

    @RequestMapping(value = "/add/boards",method = RequestMethod.POST)
    void saveBoards(@RequestBody LimsLocationBoardBean locationBoardBean);

    @RequestMapping(value = "/remove/boards",method = RequestMethod.POST)
    void removeBoards(@RequestBody LimsLocationBoardBean locationBoardBean);

    @RequestMapping(value = "/move/board",method = RequestMethod.POST)
    void moveBoard(@RequestBody LimsLocationBoardBean locationBoardBean);

    @RequestMapping(value = "/storage/{id}",method = RequestMethod.PUT)
    LimsLocationBean save(@PathVariable Long id, @RequestBody LimsLocationBean locationBean);

    @RequestMapping(value = "/box/{id}",method = RequestMethod.POST)
    LimsLocationBean editBox(@PathVariable Long id, @RequestBody LimsLocationBean locationBean);

    @RequestMapping(value = "/selectable/board",method = RequestMethod.POST)
    List<LimsLocationBoardBean> selectBoardList();

    @RequestMapping(value = "/validator/storageCode",method = RequestMethod.POST)
    JSONObject validatorCode(@RequestBody LimsLocationBean locationBean);

    @RequestMapping(value = "/local/language",method = RequestMethod.POST)
    JSONObject selectI18Message();

    //   2023-03-24 新需求
    @RequestMapping(value = "/add/area",method = RequestMethod.POST)
    Long addArea(@RequestBody List<LimsLocationBean> locationBeans);

    @RequestMapping(value = "/new/del",method = RequestMethod.POST)
    JSONObject newDelStorage(@RequestBody LimsLocationBean locationBean);

    @RequestMapping(value = "/new/add/boards",method = RequestMethod.POST)
    void newSaveBoards(@RequestBody LimsLocationBoardBean locationBoardBean);

    @RequestMapping(value = "/new/remove/boards",method = RequestMethod.POST)
    void newRemoveBoards(@RequestBody LimsLocationBoardBean locationBoardBean);

    @RequestMapping(value = "/new/move/board",method = RequestMethod.POST)
    void newMoveBoard(@RequestBody LimsLocationBoardBean locationBoardBean);

    @RequestMapping(value = "/new/queries/storage")
    List<LimsLocationBean> newQueriesStorage(@RequestBody LimsLocationBean locationBean);

    @RequestMapping(value = "/new/validator/storageCode",method = RequestMethod.POST)
    JSONObject validatorAreaCode(@RequestBody LimsLocationBean locationBean);

    //   2023-04-11 可视化分配位置
    @RequestMapping(value = "/ksh/storage/selectable", method = RequestMethod.GET)
    List<Map<String, Object>> kshStorageSelectable();
}
